//
//  SWInvitationFetchReq.swift
//  ChildStory
//
//  Created by linhan on 16/9/12.
//  Copyright © 2016年 Aiya. All rights reserved.
//

import Foundation
class SWInvitationFetchReq: SWBaseRequest
{
    override init()
    {
        super.init()
        api = SWRequestAPI.InvitationFetch
    }
    
    override func JSONToModel(_ json:JSON, JSONString:String, JSONData:Data) -> AnyObject?
    {
        return Mapper<SWInvitationFetchRsp>().map(JSONString: JSONString)
    }
}

class SWInvitationFetchRsp: NSObject,Mappable
{
    var code:Int?
    var invitations:[SWInvitationRsp]?
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        code    <- map["code"]
        invitations    <- map["data.invites"]
    }
}

class SWInvitationRsp: NSObject,Mappable
{
    //邀请函ID
    var invitationID:Int?
    var phone:String?
    var uid:String?
    var screenName:String?
    var avatarURL:String?
    //宝宝的家长名称
    var roleName:String?
    var babiesNames:[String]?
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        invitationID         <- map["id"]
        phone       <- map["mobile"]
        roleName    <- map["role_name"]
        babiesNames <- map["baby_names"]
    }
}
